<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<head>
    <th:block th:include="include :: header('预警监控')" />
</head>

<body class="gray-bg">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="notice-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                预警名称：<input type="text" name="warningName" placeholder="请输入预警名称" />
                            </li>
                            <li>
                                故障率范围:<input type="number" oninput="if(value<1)value=1" name="mindata" style="width: 70px;">-<input type="number"
                                    name="maxdata" oninput="if(value>100)value=100" style="width: 70px;">
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;查询</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var removeFlag = [[${@permission.hasPermi('system:notice:remove') }]];
        var types = [[${@dict.getType('sys_notice_type') }]];
        var datas = [[${@dict.getType('sys_notice_status') }]];
        // var prefix =  "";http://localhost:8002/";

        $(function () {
            var options = {
                url: "/youtian/failureRateMonitor/list",
                createUrl: "/add",
                updateUrl: "/edit/{id}",
                removeUrl: "/youtian/failureRateMonitor/remove",
                contentType: 'application/json',
                modalName: "公告",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'sceneName',
                    title: '场景名称',
                    width: "15%",
                    align: "center"
                },
                {
                    field: 'warningName',
                    title: '预警名称',
                    align: 'center',
                    width: "15%",
                },
                {
                    field: 'failureRate',
                    title: '故障发生率',
                    width: "15%",
                    align: 'center',
                    formatter: function (value, row, index) {

                        return failureRate = value + "%";
                    }
                },

                {
                    field: 'failureGrowthRate',
                    title: '故障增长率',
                    width: "10%",
                    align: "center",
                    formatter: function (value, row, index) {

                        return failureGrowthRate = value + "%";
                    }
                },
                {
                    field: 'warningType',
                    title: '预警方式',
                    width: "10%",
                    align: "center",
                    formatter: function (value, row, index) {

                        if (value == 0) {
                            return warningType = '同比预警'
                        } else {
                            return warningType = '环比预警'
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    width: "10%",
                    formatter: function (value, row, index) {
                        console.log(value, row, index, 111)
                        var actions = [];

                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.noticeId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>

</html>